/*
 * @Description: 
 * @Author: changqing
 * @Date: 2021-08-17 16:42:47
 * @LastEditTime: 2021-08-17 16:43:45
 * @LastEditors: changqing
 * @Usage: 
 */
var { Subject, from } = require('rxjs');

const subject = new Subject();

subject.subscribe({
  next: (v) => console.log(`observerA: ${v}`)
});
subject.subscribe({
  next: (v) => console.log(`observerB: ${v}`)
});

const observable = from([1, 2, 3]);

observable.subscribe(subject); // You can subscribe providing a Subject

// Logs:
// observerA: 1
// observerB: 1
// observerA: 2
// observerB: 2
// observerA: 3
// observerB: 3